Skip to content

feat: standalone CLI mode — browser-based Pixel Agents#1

Merged
dzhamirag-cloud merged 1 commit intomainfrom
feat/standalone-server
Mar 11, 2026
Merged

feat: standalone CLI mode — browser-based Pixel Agents#1
dzhamirag-cloud merged 1 commit intomainfrom
feat/standalone-server

Conversation

@dzhamirag-cloud
Copy link
Owner

Summary

Adds standalone CLI mode that serves the pixel office in a regular browser window, without requiring VS Code.

New files (cli/)

  • cli/main.ts — entry point, arg parsing, auto-opens browser
  • cli/server.ts — HTTP + WebSocket server (plain Node.js)
  • cli/cliOrchestrator.ts — replaces PixelAgentsViewProvider, broadcasts via WS
  • cli/sessionScanner.ts — auto-detects Claude Code sessions in ~/.claude/projects/
  • cli/persistence.ts — seats/settings stored in ~/.pixel-agents/
  • cli/vscode-stub.ts — minimal vscode API shim

Modified files

  • vscodeApi.ts — auto-detect VS Code vs browser, WebSocket bridge with reconnect + state resync
  • BottomToolbar.tsx — hint text in CLI mode instead of + Agent button
  • SettingsModal.tsx — browser file picker for layout import/export
  • types.tsterminalRef now optional
  • agentManager.ts — skip CLI agents in persistAgents
  • PixelAgentsViewProvider.ts — null-guard all terminalRef usages
  • esbuild.js--cli flag for CLI build
  • package.jsonbin, start, build:cli scripts

Usage

npm run build:cli
npm start  # or: node dist/cli.js --port 7842

Based on

Inspired by PR pablodelucca#63 with bug fixes:

  • WebSocket bridge sends webviewReady on reconnect (fixes blank UI)
  • Improved directory traversal prevention in HTTP server
  • import.meta.url fallback for ESM compatibility

Add cli/ directory with standalone HTTP + WebSocket server that serves
the pixel office in a regular browser window, without requiring VS Code.

Architecture:
- cli/main.ts — entry point, parses args, opens browser
- cli/server.ts — HTTP static file server + WebSocket on /ws
- cli/cliOrchestrator.ts — replaces PixelAgentsViewProvider, broadcasts via WS
- cli/sessionScanner.ts — auto-detects Claude Code sessions in ~/.claude/projects/
- cli/persistence.ts — seats/settings stored in ~/.pixel-agents/
- cli/vscode-stub.ts — minimal vscode API shim for bundling

Frontend changes:
- webview-ui/src/vscodeApi.ts — auto-detect VS Code vs browser, WebSocket bridge
  with auto-reconnect and state resync on reconnect
- BottomToolbar.tsx — show hint text instead of + Agent button in CLI mode
- SettingsModal.tsx — browser file picker for layout import/export in CLI mode

Backend changes:
- src/types.ts — terminalRef now optional (CLI agents have no terminal)
- src/agentManager.ts — skip CLI agents in persistAgents
- src/PixelAgentsViewProvider.ts — null-guard all terminalRef usages

Build:
- esbuild.js — new --cli flag builds dist/cli.js with vscode stub alias
- package.json — add bin, start, build:cli scripts; ws dependency

Usage:
  npm run build:cli
  npm start  # or: node dist/cli.js --port 7842
@dzhamirag-cloud dzhamirag-cloud merged commit 9c643ac into main Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant